package stub.logicsvStub;

import vo.CouStuScoListVO;
import vo.CouStuScoSecVO;
import vo.CourseVO;
import vo.StuCouScoListVO;
import vo.TeaCouListVO;
import logicsv.courseQuery_logicsv.CourseQueryLogicsv;
import datasv.courseQuery_datasv.CourseQueryRM;

public class CourseQueryLogicsvStub implements CourseQueryLogicsv{
	CourseVO course;
	CouStuScoListVO csslvo;
	StuCouScoListVO scslvo;
	TeaCouListVO tclvo;
	@Override
	public CourseVO getCourse(String courseID) {
		return course;
	}

	@Override
	public CouStuScoListVO getAllStuOfCou(String courseID) {
		// TODO Auto-generated method stub
		if(courseID.equals(csslvo.getCourseVO().getCourseBasicPO().getCourseId())){
			return csslvo;
		}
		return null;
	}
@Override
	public CouStuScoSecVO getCouStuScoSec(String courseID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
public TeaCouListVO getAllCouOfTea(String teacherID) {
	// TODO Auto-generated method stub
		if(tclvo.getTeacherVO().getTeacherPO().getTeacherID().equals(teacherID)){
			return tclvo;
		}
	return null;
}

	@Override
	public CourseQueryRM deleteStuCouRec(String courseID, String studentID) {
		// TODO Auto-generated method stub
		if(!csslvo.getCourseVO().getCourseBasicPO().getCourseId().equals(courseID)){
			return CourseQueryRM.COURSEID_NOT_EXIST;
		}
		if(!csslvo.getStudentScore().keySet().contains(studentID)){
			return CourseQueryRM.STUDENT_NOT_EXIST;
		}
		return CourseQueryRM.SUCCESS;
	}

	@Override
	public CourseQueryRM addStuCouRec(String courseID, String studentID) {
		// TODO Auto-generated method stub
		if(!csslvo.getCourseVO().getCourseBasicPO().getCourseId().equals(courseID)){
			return CourseQueryRM.COURSEID_NOT_EXIST;
		}
		if(csslvo.getStudentScore().keySet().contains(studentID)){
			return CourseQueryRM.STUDENT_EXIST;
		}
		return CourseQueryRM.SUCCESS;
	}
	@Override
	public CourseQueryRM updateStuCouScoRec(String courseID, String studentID,
			int score) {
		// TODO Auto-generated method stub
		if(!csslvo.getCourseVO().getCourseBasicPO().getCourseId().equals(courseID)){
			return CourseQueryRM.COURSEID_NOT_EXIST;
		}
		if(!csslvo.getStudentScore().keySet().contains(studentID)){
			return CourseQueryRM.STUDENT_NOT_EXIST;
		}
		return CourseQueryRM.SUCCESS;
	}

	@Override
	public CourseQueryRM deleteCouOfTea(String courseID, String teacherID) {
		// TODO Auto-generated method stub
		if(!tclvo.getTeacherVO().getTeacherPO().getTeacherID().equals(teacherID)){
			return CourseQueryRM.TEACHERID_NOT_EXIST;
		}
		if(!tclvo.getCourseVOList().contains(courseID)){
			return CourseQueryRM.COURSEID_EXIST;
		}
		return  CourseQueryRM.SUCCESS;
	}

	@Override
	public CourseQueryRM addCouOfTea(String courseID, String teacherID) {
		// TODO Auto-generated method stub
		if(!tclvo.getTeacherVO().getTeacherPO().getTeacherID().equals(teacherID)){
			return CourseQueryRM.TEACHERID_NOT_EXIST;
		}
		if(tclvo.getCourseVOList().contains(courseID)){
			return CourseQueryRM.COURSEID_EXIST;
		}
		return  CourseQueryRM.SUCCESS;
	}
	
}
